<%-- 
    Document   : createticket
    Created on : Nov 23, 2009, 11:01:17 PM
    Author     : brian
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList,helpdesk.Expertise"%>

<%!
    String err;
    ArrayList<Expertise> expertises;
%>

<%
    if ((err=(String)request.getAttribute("error")) == null)
        err = "";
    
    expertises = (ArrayList<Expertise>)request.getAttribute("expertises");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <%@include file="headtags.html"%>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Create Ticket</title>
    </head>
    <body>
        <%@include file="menu.html"%>
        <%= err %>
        <table class="content" width ="100%"><tr class="heading"><td align="center">Create Ticket</td></tr><tr><td>
        <form name="ticket_form" method="POST" action="createticket.jsp">
        <%
            if (expertises != null && expertises.size() > 0)
            {
                %>
                <p>What is the area of your problem?</p>
                <select name="expertise"><%
                for (int i=0;i<expertises.size();i++)
                {
                    Expertise exp = expertises.get(i);
                    int id = exp.getId();
                    String name= exp.getName();
                    String selected;

                    if (i==0)
                    {
                        %>
                        <option value="<%=id%>" selected="selected">
                        <%= name %>
                        </option>
                        <%
                    }
                    else
                    {
                         %>
                        <option value="<%=id%>">
                        <%= name %>
                        </option>
                        <%
                    }
                }
                %>
                </select>

                <br />
                <p>How urgent is your problem, on a scale of 1 to 5?</p>
                <input type="radio" name="priority" value="1" /> 1
                <input type="radio" name="priority" value="2" /> 2
                <input type="radio" name="priority" value="3" /> 3
                <input type="radio" name="priority" value="4" /> 4
                <input type="radio" name="priority" value="5" /> 5

                <br />
                <p>Enter a title for your problem:</p>
                <input type="text" name="title">

                <br />
                <p>Enter a description for your problem:</p>
                <textarea name="description" rows="8" cols="40"></textarea><br />

                <input type="submit" value="Submit Ticket" />
                <%
            }
            else
            {
                %> <h1>Database problem; cannot continue</h1> <%
            }
        %>
        </form>
        </td></tr></table>
    </body>
</html>
